<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Whisper: packet_builder.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Whisper
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">packet_builder.h</div>  </div>
</div>
<div class="contents">
<a href="packet__builder_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef __PACKET_BUILDER_H__</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define __PACKET_BUILDER_H__ 1</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;<a class="code" href="packet__source_8h.html">packet_source.h</a>&quot;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &quot;<a class="code" href="ext__bit__source_8h.html">ext_bit_source.h</a>&quot;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &quot;<a class="code" href="properties__reader_8h.html">properties_reader.h</a>&quot;</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00009"></a>00009 
<a name="l00010"></a><a class="code" href="classCPacketBuilder.html">00010</a> <span class="keyword">class </span><a class="code" href="classCPacketBuilder.html">CPacketBuilder</a> : <span class="keyword">public</span> <a class="code" href="classIExtBitSource.html" title="abstract steg payload bit source">IExtBitSource</a>
<a name="l00011"></a>00011 {
<a name="l00012"></a>00012 <span class="keyword">public</span>:
<a name="l00013"></a>00013 
<a name="l00014"></a>00014         <a class="code" href="classCPacketBuilder.html#aee1a235efdbd190ca5d8f4a14e099bdc">CPacketBuilder</a>(<a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>* pConfig, <a class="code" href="classIPacketSource.html" title="packet source implementing a packet-based protocol">IPacketSource</a>* pPacketSource);
<a name="l00015"></a>00015         <span class="keyword">virtual</span> <a class="code" href="classCPacketBuilder.html#a4847309e73ddb3d2281a645971b33bec">~CPacketBuilder</a>();
<a name="l00016"></a>00016 
<a name="l00017"></a>00017         <span class="keyword">virtual</span> <a class="code" href="classIExtBitSource.html#aa0bbdedd57f84dedbe13dbf6bdff6f4a">EBitValue</a> <a class="code" href="classCPacketBuilder.html#a83f920ecd9efcf50d53411a4eb346249">getBit</a>();
<a name="l00018"></a>00018         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classCPacketBuilder.html#a23dc1c4a72fd2fc79ecd0fb6f2fc0569">putBit</a>(<span class="keywordtype">bool</span> pBitValue, <span class="keywordtype">bool</span> pFirstBit);
<a name="l00019"></a>00019         <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCPacketBuilder.html#ab50a7766db2735cdea1206cfe62d979a">getMaxFrameLength</a>();
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="keyword">private</span>:
<a name="l00022"></a><a class="code" href="classCPacketBuilder.html#abbea5718fbb311af19e513aa96448c67">00022</a>         <span class="keyword">enum</span> <a class="code" href="classCPacketBuilder.html#abbea5718fbb311af19e513aa96448c67">ESendPacketState</a>
<a name="l00023"></a>00023         {
<a name="l00024"></a><a class="code" href="classCPacketBuilder.html#abbea5718fbb311af19e513aa96448c67ab3c83e466ca00f07e2b89102e8fe5d9e">00024</a>                 <a class="code" href="classCPacketBuilder.html#abbea5718fbb311af19e513aa96448c67ab3c83e466ca00f07e2b89102e8fe5d9e">SEND_STATE_WAIT_FOR_NEXT</a> = 0,
<a name="l00025"></a><a class="code" href="classCPacketBuilder.html#abbea5718fbb311af19e513aa96448c67ae168dd464ea46a07eb3d06906da18617">00025</a>                 <a class="code" href="classCPacketBuilder.html#abbea5718fbb311af19e513aa96448c67ae168dd464ea46a07eb3d06906da18617">SEND_STATE_NEXT_IS_READY</a>,
<a name="l00026"></a><a class="code" href="classCPacketBuilder.html#abbea5718fbb311af19e513aa96448c67aced1a5079f07e517a184e23f8ba7e069">00026</a>                 <a class="code" href="classCPacketBuilder.html#abbea5718fbb311af19e513aa96448c67aced1a5079f07e517a184e23f8ba7e069">SEND_STATE_PACKET</a>,
<a name="l00027"></a>00027         };
<a name="l00028"></a>00028 
<a name="l00029"></a><a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3">00029</a>         <span class="keyword">enum</span> <a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3">ERecvPacketState</a>
<a name="l00030"></a>00030         {
<a name="l00031"></a><a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3ab927d9e368e3ee87fb66426ab7f19cde">00031</a>                 <a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3ab927d9e368e3ee87fb66426ab7f19cde">RECV_STATE_WAIT_FOR_NEXT</a> = 0,
<a name="l00032"></a><a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3a6ff438ada675b4df7c9160acfccd70e6">00032</a>                 <a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3a6ff438ada675b4df7c9160acfccd70e6">RECV_STATE_BEGIN</a>,
<a name="l00033"></a><a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3a03b413fa49cc13538fc3b686d52523a1">00033</a>                 <a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3a03b413fa49cc13538fc3b686d52523a1">RECV_STATE_LENGTH_FIELD</a>,
<a name="l00034"></a><a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3a33a94928ba38794a2ccad48ccdb83129">00034</a>                 <a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3a33a94928ba38794a2ccad48ccdb83129">RECV_STATE_PAYLOAD</a>,
<a name="l00035"></a>00035         };
<a name="l00036"></a>00036 
<a name="l00037"></a><a class="code" href="classCPacketBuilder.html#ad11538f861ae424701c94713341af1a1">00037</a>         <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="classCPacketBuilder.html#ad11538f861ae424701c94713341af1a1">sIniSection</a>;
<a name="l00038"></a>00038 
<a name="l00039"></a><a class="code" href="classCPacketBuilder.html#a5377d2447dd5b25a67c379248babc5ca">00039</a>         <span class="keywordtype">bool</span> <a class="code" href="classCPacketBuilder.html#a5377d2447dd5b25a67c379248babc5ca">mError</a>;
<a name="l00040"></a><a class="code" href="classCPacketBuilder.html#aa4c1bff0467b28622b8c6133deb4b69d">00040</a>         <a class="code" href="properties__reader_8h.html#a67847fd00cb49d80dd45f61722eb9a43">CPropertiesReader</a>* <a class="code" href="classCPacketBuilder.html#aa4c1bff0467b28622b8c6133deb4b69d">mConfig</a>;
<a name="l00041"></a><a class="code" href="classCPacketBuilder.html#abad2cce898f78d8c38fdb0b873f00dbb">00041</a>         <a class="code" href="classIPacketSource.html" title="packet source implementing a packet-based protocol">IPacketSource</a>* <a class="code" href="classCPacketBuilder.html#abad2cce898f78d8c38fdb0b873f00dbb">mPacketSource</a>;
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="classCPacketBuilder.html#a5c5962a8091ba05b589b8788cd002ece">00043</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCPacketBuilder.html#a5c5962a8091ba05b589b8788cd002ece">mMaxPayload</a>;
<a name="l00044"></a><a class="code" href="classCPacketBuilder.html#ab84ca95996b25526f36866ac5ae0f588">00044</a>         <span class="keywordtype">bool</span> <a class="code" href="classCPacketBuilder.html#ab84ca95996b25526f36866ac5ae0f588">mIgnoreWrongCRC</a>;
<a name="l00045"></a>00045 
<a name="l00046"></a><a class="code" href="classCPacketBuilder.html#a134cb0e013ddf5ad34fbd9fe204ae632">00046</a>         <a class="code" href="namespaceNPacketSource.html#a41d32c941906c55fd056bc4be5e0c79b">NPacketSource::EPayloadInfo</a> <a class="code" href="classCPacketBuilder.html#a134cb0e013ddf5ad34fbd9fe204ae632">mSendPayloadInfo</a>;
<a name="l00047"></a><a class="code" href="classCPacketBuilder.html#a19b5eca0e74948e53cf55568ccddce8a">00047</a>         <a class="code" href="classCPacketBuilder.html#abbea5718fbb311af19e513aa96448c67">ESendPacketState</a> <a class="code" href="classCPacketBuilder.html#a19b5eca0e74948e53cf55568ccddce8a">mSendState</a>;
<a name="l00048"></a><a class="code" href="classCPacketBuilder.html#a441cf84e62698c8a0303083ab18dbb45">00048</a>         std::vector&lt;bool&gt; <a class="code" href="classCPacketBuilder.html#a441cf84e62698c8a0303083ab18dbb45">mSendPacket</a>;
<a name="l00049"></a><a class="code" href="classCPacketBuilder.html#af20c05841f12ae9386e7817bf9d794b9">00049</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCPacketBuilder.html#af20c05841f12ae9386e7817bf9d794b9">mSendBitCount</a>;
<a name="l00050"></a><a class="code" href="classCPacketBuilder.html#ab1aa160f71acd51cf7be170454b46416">00050</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCPacketBuilder.html#ab1aa160f71acd51cf7be170454b46416">mSendBitIndex</a>;
<a name="l00051"></a><a class="code" href="classCPacketBuilder.html#aab69009e195d44e0bb8776285f17d277">00051</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCPacketBuilder.html#aab69009e195d44e0bb8776285f17d277">mSendPayloadLength</a>;
<a name="l00052"></a>00052 
<a name="l00053"></a><a class="code" href="classCPacketBuilder.html#ad20f0d602233bceb8f739e59cd435953">00053</a>         <a class="code" href="classCPacketBuilder.html#a5e3c5517522920fb21c8a161586ec4b3">ERecvPacketState</a> <a class="code" href="classCPacketBuilder.html#ad20f0d602233bceb8f739e59cd435953">mRecvState</a>;
<a name="l00054"></a><a class="code" href="classCPacketBuilder.html#a84bca46dfb8d1488d52b3c5534c986a0">00054</a>         std::vector&lt;bool&gt; <a class="code" href="classCPacketBuilder.html#a84bca46dfb8d1488d52b3c5534c986a0">mRecvPacket</a>;
<a name="l00055"></a><a class="code" href="classCPacketBuilder.html#aaf25ffd0b42977833b58e2d6a9e395ea">00055</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCPacketBuilder.html#aaf25ffd0b42977833b58e2d6a9e395ea">mRecvBitCount</a>;
<a name="l00056"></a><a class="code" href="classCPacketBuilder.html#a3d8ef51647f24a933a743ec2258fc008">00056</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCPacketBuilder.html#a3d8ef51647f24a933a743ec2258fc008">mRecvBitIndex</a>;
<a name="l00057"></a><a class="code" href="classCPacketBuilder.html#a932a4a895d4bedb9b1c981714c481c55">00057</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCPacketBuilder.html#a932a4a895d4bedb9b1c981714c481c55">mRecvPayloadLength</a>;
<a name="l00058"></a>00058 <span class="preprocessor">#if 0</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span>        <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *mReadBuf; <span class="comment">// is used for getBit payload</span>
<a name="l00060"></a>00060         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mReadBufLen; <span class="comment">// full byte length of mReadBuf</span>
<a name="l00061"></a>00061         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mReadPayloadLen; <span class="comment">// payload length of current frame</span>
<a name="l00062"></a>00062         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mReadIndex;
<a name="l00063"></a>00063 <span class="preprocessor">#endif</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span>        <a class="code" href="namespaceNPacketSource.html#a41d32c941906c55fd056bc4be5e0c79b">NPacketSource::EPayloadInfo</a> <a class="code" href="classCPacketBuilder.html#a7f85bf7867f191dd3b70c96b7fa1c12b">createNextSendPacket</a>();
<a name="l00065"></a>00065         <span class="comment">//void setPayloadForSend(unsigned char* pPayload, unsigned int pLength);</span>
<a name="l00066"></a>00066 
<a name="l00067"></a>00067         <span class="keywordtype">bool</span> <a class="code" href="classCPacketBuilder.html#a7a00dcb89b6af5670e6865b00cb0f8ca">writeByteToBoolVector</a>(std::vector&lt;bool&gt; &amp;pVector,
<a name="l00068"></a>00068                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pStartIndex,
<a name="l00069"></a>00069                         <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> pByteValue);
<a name="l00070"></a>00070 
<a name="l00071"></a>00071         <span class="keywordtype">bool</span> <a class="code" href="classCPacketBuilder.html#a9c1f2a51958c83e346295d47d3eaf13d">readByteFromBoolVector</a>(std::vector&lt;bool&gt; &amp;pVector,
<a name="l00072"></a>00072                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pStartIndex,
<a name="l00073"></a>00073                         <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>&amp; pByteValue);
<a name="l00074"></a>00074 
<a name="l00075"></a>00075         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCPacketBuilder.html#a0aecfdc83b0950d099668943b653d6d7">readBytesFromBoolVector</a>(std::vector&lt;bool&gt; &amp;pVector,
<a name="l00076"></a>00076                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pStartIndex,
<a name="l00077"></a>00077                         <span class="keywordtype">void</span>* pBytes,
<a name="l00078"></a>00078                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pLength);
<a name="l00079"></a>00079 
<a name="l00080"></a>00080         <a class="code" href="classCPacketBuilder.html#aee1a235efdbd190ca5d8f4a14e099bdc">CPacketBuilder</a>(<span class="keyword">const</span> <a class="code" href="classCPacketBuilder.html">CPacketBuilder</a>&amp; );
<a name="l00081"></a>00081         <a class="code" href="classCPacketBuilder.html">CPacketBuilder</a>&amp; <a class="code" href="classCPacketBuilder.html#a01cabb7ef3a4a759ba4f47748451bd19">operator=</a>(<span class="keyword">const</span> <a class="code" href="classCPacketBuilder.html">CPacketBuilder</a>&amp; );
<a name="l00082"></a>00082 };
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 <span class="preprocessor">#endif // __PACKET_BUILDER_H__</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Wed Jan 25 2012 22:00:39 for Whisper by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
